<template>
    <div class="content">
        <div class="main">
            <div class="main-box">
                <div class="bjcl">报警车辆TOP5</div>
                <div id="dcbj" class="chart"></div>
            </div>
        </div>
    </div>
</template>
<script>
import * as echarts from "echarts";
export default {
    name: 'App',
    data() {
        return {}
    },
    mounted: function () {
        this.$nextTick(function () {
            this.getPie()
        })
    },
    methods: {
        getPie() {
            // 绘制图表
            var myChart = echarts.init(document.getElementById('dcbj'))
            // 指定图表的配置项和数据
            var option = {
                title: {
                },
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'shadow'
                    }
                },
                grid: {
                    left: '8%',
                    right: '8%',
                    top: '18%',
                    containLabel: true
                },
                xAxis: [
                    {
                        type: 'category',
                        data: ['', 'NO.1', 'NO.2', 'NO.3', 'NO.4', 'NO.5'],
                    
                        splitLine: {
                            show: false,
                            lineStyle: {
                                color: "rgba(255,255,255,0.2)"
                            }
                        },
                        axisTick: {
                            show: false
                        },
                        axisLine: {
                            show: true,
                            color: "rgba(255,255,255,0.2)"
                        },
                        axisLabel: {
                            textStyle: {
                                color: '#b6b5ab'
                            }
                        }
                    }
                ],
                yAxis: [
                    {
                        type: 'value',
                        splitLine: false,
                        splitLine: {
                            show: false,
                            lineStyle: {
                                color: "rgba(255,255,255,0.2)"
                            }
                        },
                        axisTick: {
                            show: false
                        },
                        axisLine: {
                            show: true,
                            color: "rgba(255,255,255,0.2)"
                        },
                        axisLabel: {
                            show: true,
                            color: '#b6b5ab'
                        }
                    }
                ],
                series: [
                    {
                        name: 'hill',
                        type: 'pictorialBar',
                        barCategoryGap: '-50%',
                        symbol: 'triangle',
                        itemStyle: {
                            normal: {
                                color: function (params) {
                                    //注意，如果颜色太少的话，后面颜色不会自动循环，最好多定义几个颜色
                                    var colorList = ['rgba(12,147,181,0.1)', 'rgba(12,147,181,0.5)',
                                        'rgba(19,71,141,0.5)', 'rgba(12,147,181,0.5)',
                                        'rgba(19,71,141,0.5)', 'rgba(12,147,181,0.5)'];
                                    return colorList[params.dataIndex]
                                }
                            },
                            emphasis: {
                                opacity: 1
                            }
                        },
                        data: [, 601, 500, 601, 450, 350],
                        z: 10
                    },
                ]
            };

            // 使用刚指定的配置项和数据显示图表。
            myChart.setOption(option)
        }
    }

}


</script>
<style scoped lang="less">
.content {
    position: relative;
    box-sizing: border-box;
    background-color: rgba(15, 32, 95, 0.7);
}

.main-box {
    position: absolute;
    height: 175px;
    width: calc(100%-4px);
    background-image:
        url("../assets/picture/bj-1.png"),
        url("../assets/picture/bj-2.png"),
        url("../assets/picture/bj-4.png"),
        url("../assets/picture/bj-3.png");
    background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
    background-position: top left, top right, bottom left, bottom right;
    z-index: 1;
    top: 1px;
    left: 1px;
    bottom: 1px;
    right: -2px;
}

.main {
    height: 175px;
    width: 100%;
    border: 1px solid #1723b0;
}

.chart {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 280px;
    height: 230px;
}

.bjcl {
    position: absolute;
    top: 5px;
    left: 9px;
    color: #ffffff;
    font-weight: 600;
    font-size: 12px;
}
</style>